package edu.pku.sei.transformation.mtparser;

import lpg.runtime.*;

/**
 *<b>
 *<li>Rule 40:  UnionExpr ::= union ( AtomicExpr$FirstPart , AtomicExpr$SecoundPart )
 *</b>
 */
public class UnionExpr extends Ast implements IUnionExpr
{
    private IAtomicExpr _FirstPart;
    private IAtomicExpr _SecoundPart;

    public IAtomicExpr getFirstPart() { return _FirstPart; }
    public IAtomicExpr getSecoundPart() { return _SecoundPart; }

    public UnionExpr(IToken leftIToken, IToken rightIToken,
                     IAtomicExpr _FirstPart,
                     IAtomicExpr _SecoundPart)
    {
        super(leftIToken, rightIToken);

        this._FirstPart = _FirstPart;
        this._SecoundPart = _SecoundPart;
        initialize();
    }

    public boolean equals(Object o)
    {
        if (o == this) return true;
        if (! (o instanceof UnionExpr)) return false;
        if (! super.equals(o)) return false;
        UnionExpr other = (UnionExpr) o;
        if (! _FirstPart.equals(other._FirstPart)) return false;
        if (! _SecoundPart.equals(other._SecoundPart)) return false;
        return true;
    }

    public int hashCode()
    {
        int hash = super.hashCode();
        hash = hash * 31 + (_FirstPart.hashCode());
        hash = hash * 31 + (_SecoundPart.hashCode());
        return hash;
    }

    public void accept(Visitor v) { v.visit(this); }
    public void accept(ArgumentVisitor v, Object o) { v.visit(this, o); }
    public Object accept(ResultVisitor v) { return v.visit(this); }
    public Object accept(ResultArgumentVisitor v, Object o) { return v.visit(this, o); }
}


